<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class design extends Model {

	function Design()
	{
		parent::Model();
	}
	function title()
	{
		$query = $this->db->query('SELECT * FROM project LIMIT 1');
		foreach ($query->result() as $row) {
			return $row->title;
		}
	}

	function dashlink()
	{
	if ($this->uri->uri_string() != '') { 
			echo anchor('', 'Back to dashboard', array('id' => 'dashboard'));
			} 
	}
	/**
	* function lastdesign()
	* returns the filename of the latest design uploaded
	*/
	function lastdesign()
	{
		$query = $this->db->get('designs', 1);
		foreach($query->result() as $row) {
			return $row->image;
		}
	}
	function editlinks($sector, $id, $user, $before, $after) {
		if($this->users->getInfo($this->users->user, "id") == $user) {
		$links = anchor($sector . '/edit/' . $id, "Edit") . ' // ' . anchor($sector . '/delete/' . $id, "Delete");
		return $before . $links . $after;
		}
	}
}

?>